package com.kurumi.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

/**
 * 配置文件读取
 * @author lyh
 *
 */
@Configuration
@PropertySource(value="classpath:application.properties") 
public class MyConfig {

	
	@Value("${config.remote.login.url}")
	private String remoteLoginUrl;
	
	@Value("${config.remote.interface.url}")
	private String remoteInterfaceUrl;
	
	@Value("${config.solr.core.path}")
	private String solrCorePath;

	@Value("${config.image.resource.path}")
	private String imageRecourcePath;
	
	@Value("${config.pdf.resource.path}")
	private String pdfRecourcePath;
	
	@Value("${config.json.resource.path}")
	private String jsonRecourcePath;
	
	@Value("${config.current.version}")
	private String currentVersion;
	
	@Value("${config.borrow.limit.day}")
	private String borrowLimitDay;

	@Value("${config.page.index.pdf.template.path}")
	private String pageIndexpPdfTemplatePath;
	
	@Value("${config.worker.signature.path}")
	private String workerSignaturePath;

	@Value("${config.default_print.type.code}")
	private String defaultPrintTypeCode;
	
	/**
	 * 疾病分类版本
	 */
	@Value("${config.current.disease.version}")
	private String currentDiseaseVersion;
	
	/**
	 * 手术分类版本
	 */
	@Value("${config.current.surgery.version}")
	private String currentSurgeryVersion;
	
	@Value("${config.org.code}")
	private String orgCode;
	
	@Value("${config.org.name}")
	private String orgName;
	
	public String getRemoteLoginUrl() {
		return remoteLoginUrl;
	}

	public void setRemoteLoginUrl(String remoteLoginUrl) {
		this.remoteLoginUrl = remoteLoginUrl;
	}

	
	
	public String getRemoteInterfaceUrl() {
		return remoteInterfaceUrl;
	}

	public String getCurrentVersion() {
		return currentVersion;
	}

	public void setCurrentVersion(String currentVersion) {
		this.currentVersion = currentVersion;
	}

	public String getImageRecourcePath() {
		return imageRecourcePath;
	}

	public void setImageRecourcePath(String imageRecourcePath) {
		this.imageRecourcePath = imageRecourcePath;
	}

	public String getPdfRecourcePath() {
		return pdfRecourcePath;
	}

	public void setPdfRecourcePath(String pdfRecourcePath) {
		this.pdfRecourcePath = pdfRecourcePath;
	}
	
	
	
	
	public String getSolrCorePath() {
		return solrCorePath;
	}

	public String getJsonRecourcePath() {
		return jsonRecourcePath;
	}

	public void setJsonRecourcePath(String jsonRecourcePath) {
		this.jsonRecourcePath = jsonRecourcePath;
	}

	public int getBorrowLimitDay(){
		int defaultLimitDay = 7;
		if(this.borrowLimitDay != null){
			try {
				return Integer.parseInt(borrowLimitDay);
			} catch (Exception e) {
				// TODO: handle exception
				e.printStackTrace();
			}
		}
		return defaultLimitDay;
	}

	public String getPageIndexpPdfTemplatePath() {
		return pageIndexpPdfTemplatePath;
	}

	public String getWorkerSignaturePath() {
		return workerSignaturePath;
	}

	public String getDefaultPrintTypeCode() {
		return defaultPrintTypeCode;
	}

	public String getCurrentDiseaseVersion() {
		return currentDiseaseVersion;
	}

	public String getCurrentSurgeryVersion() {
		return currentSurgeryVersion;
	}

	public String getOrgCode() {
		return orgCode;
	}

	public String getOrgName() {
		return orgName;
	}

	
	
	
}
